﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using com.lover.astd.common.model;
using com.lover.astd.common;
using com.lover.astd.common.config;

namespace com.lover.astd.game.ui.server.impl.secretary
{
    /// <summary>
    /// 小秘书服务, 每半小时运行一次, 如果已经没有任务可做, 顺延至下一天
    /// </summary>
    class SecretaryServer : LogicServer
    {
        public SecretaryServer(MainForm frm) { _mainForm = frm; ServerName = ConfigStrings.S_Secretary; ServerReadableName = ConfigStrings.SR_Secretary; }
        public override void renderSettings()
        {
            Dictionary<string, string> conf = getConfig(ServerName);
            MainForm frm = _mainForm;
            frm.chk_dailytask_enable.Checked = conf.ContainsKey(ConfigStrings.enabled) && conf[ConfigStrings.enabled].ToLower().Equals("true");
        }
        public override void saveSettings()
        {
            GameConfig conf = getConfig();
            MainForm frm = _mainForm;
            conf.setConfig(ServerName, ConfigStrings.enabled, frm.chk_dailytask_enable.Checked.ToString());
        }
        public override void loadDefaultSettings()
        {
            GameConfig conf = getConfig();
            conf.setConfig(ServerName, ConfigStrings.enabled, "true");
            renderSettings();
        }
    }
}
